package com.sxj.corejava.code07_面向对象.租车系统;

/**
 * @author 石小俊
 * @date 2025年01月07日
 */
public class Car extends MotorVehicle {

    private String type;    // 型号

    public Car(String no, String brand, String type) {
        super(no, brand);
        this.type = type;
    }

    public Car() {
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    /**
     * @param day 租车的天数
     * @return
     * @see CarConstant
     */
    @Override
    public double rent(int day) {
        double sum = 0;
        switch (type) {
            case CarConstant.BMW_X1:
                sum = CarConstant.BMW_X1_RENT * day;
                break;
            case CarConstant.BENZ_GLC:
                sum = CarConstant.BENZ_GLC_RENT * day;
                break;
            case CarConstant.PORSCHE_PANAMERA:
                sum = CarConstant.PORSCHE_PANAMERA_RENT * day;
                break;
            case CarConstant.ROLLS_ROYCE_PHANTOM:
                sum = CarConstant.ROLLS_ROYCE_PHANTOM_RENT * day;
                break;
        }
        return sum;
    }
}
